package com.xiongwei.principle.singleresponsibility;

/**
 *  将交通工具拆分为空中，陆地，水下交通工具。
 *  缺点：代价较大，需要同时修改客户端和服务端。
 */
public class SingerResponsibility2 {

    public static void main(String[] args) {
        new AirVehicle().run("汽车");
        new RoadVehicle().run("飞机");
        new WaterVehicle().run("船");

    }
}

class AirVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在空中行驶");
    }
}

class RoadVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在路上行驶");
    }
}

class WaterVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在水中行驶");
    }
}
